
#ifndef __VOL_FILE_IO_H__
#define __VOL_FILE_IO_H__

class CVolFileProcessor : public CVolCommonBase
{
public:
    static BOOL sSetCurrentPos (const HANDLE hFile, INT64 n64CurrentPos);
    static INT64 sGetCurrentPos (const HANDLE hFile)  { return sMoveAndGetFilePos (hFile, FILE_CURRENT); }
    static INT64 sMoveToEndAndGetFileSize (const HANDLE hFile)  { return sMoveAndGetFilePos (hFile, FILE_END); }
    static INT64 sMoveAndGetFilePos (const HANDLE hFile, DWORD dwMoveMethod);
    static BOOL sReadData (const HANDLE hFile, void* pData, const INT_P npDataSize);
    static BOOL sWriteData (const HANDLE hFile, const void* pData, const INT_P npDataSize);

    static HANDLE sOpenFile (const TCHAR* szFileName, const INT_P npFileOpenMode, const INT_P npFileShareMode);
    static BOOL sLockFile (HANDLE hFile, INT64 n64LockOffset, INT64 n64LockSize, INT_P npRetryLockTime);
    static CVolMem& sReadBin (HANDLE hFile, const INT_P npReadSize, CVolMem& memData);
    static CVolString& sReadText (HANDLE hFile, INT_P npMaxReadChars, INT_P npCharSet, BOOL_P* pblpOnlyReadOneLine, BOOL_P* pblpSucceeded, CVolString& strData);
    static BOOL sWriteText (HANDLE hFile, const TCHAR* szText, BOOL_P blpWriteEndZeroChar, INT_P npCharSet);
    static CVolString& sReadLine (const HANDLE hFile, INT_P npCharSet, CVolString& strLine);
    static BOOL sWriteLine (const HANDLE hFile, INT_P npCharSet, const TCHAR* szLine);
    static BOOL sIsEof (const HANDLE hFile, const BOOL_P blpCheckTextEndChar, INT_P npCharSet);
    static INT64 sGetFileSize (const HANDLE hFile);
};

#endif
